/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sd.chat;

import java.io.Serializable;
import java.util.GregorianCalendar;

/**
 *
 * @author Old
 */
public class Comment implements Serializable, Comparable {

    private String text;
    private int id;
    private Utilizador user;
    private int postId;
    private GregorianCalendar data;
    private String fbId = "";

    public Comment(String text, int id, Utilizador user, int post, GregorianCalendar data) {
        this.text = text;
        this.id = id;
        this.user = user;
        this.data = data;
        this.postId = post;
    }

    public Comment(String text, int id, Utilizador user, int post) {
        this.text = text;
        this.id = id;
        this.user = user;
        this.postId = post;
        this.data = new GregorianCalendar();
    }

    public GregorianCalendar getData() {
        return data;
    }

    public void setData(GregorianCalendar data) {
        this.data = data;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Utilizador getUser() {
        return user;
    }

    public void setUser(Utilizador user) {
        this.user = user;
    }

    public int getPostId() {
        return postId;
    }

    public void setPostId(int postId) {
        this.postId = postId;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Comment other = (Comment) obj;
        if (this.id != other.id) {
            return false;
        }
        if (this.data != other.data && (this.data == null || !this.data.equals(other.data))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + this.id;
        hash = 97 * hash + (this.data != null ? this.data.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Comment{" + "text=" + text + ", id=" + id + ", user=" + user + ", postId=" + postId + '}';
    }
    
    @Override
    public int compareTo(Object o) {
        return this.data.compareTo(((Comment)o).getData());
    }

    public String getFbId() {
        return fbId;
    }

    public void setFbId(String fbId) {
        this.fbId = fbId;
    }
    
    
}
